import cv2 as cv
import numpy as np

cap = cv.VideoCapture(4)
while(1):
    # Take each frame
    _, frame = cap.read()
    # Convert BGR to HSVg
    hsv = cv.cvtColor(frame, cv.COLOR_BGR2HSV)

    # define range of blue color in HSV
    lower_blue = np.array([156, 43, 46])
    upper_blue = np.array([180, 255, 255])
    # Threshold the HSV image to get only blue colors
    mask = cv.inRange(hsv, lower_blue, upper_blue)
    # Bitwise-AND mask and original image
    cv.imshow("test",frame)
    # cv.waitKey()
    res = cv.bitwise_and(frame, frame, mask=mask)
    cv.imshow("frame", res)
    k = cv.waitKey(30)
    if k == 27:
        break
cv.destroyAllWindows()
